EXE = bmp 

CC = cc

CFLAGS = -Wall -Wextra -march=native -std=c11 
LDLIBS = -lm

SRC_DIR=src
OBJ_DIR=obj


SRC = $(wildcard *.c)
OBJ = $(SRC:%.c=$(OBJ_DIR)/%.o)

.PHONY: all clean


all: directories $(EXE)


directories:
	@mkdir -p $(OBJ_DIR)

$(EXE): $(OBJ)
	$(CC) $^ $(LDLIBS) -o $@


$(OBJ_DIR)/%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@


clean:
	$(RM) $(OBJ) $(EXE) -r $(OBJ_DIR)


run: directories $(EXE)
	./$(EXE)
